import {Injectable} from '@angular/core';
import {Subject} from 'rxjs/Subject';
import {LogUtil} from '../util/log-util';
import {Observable} from 'rxjs/Observable';
import {ReplaySubject} from 'rxjs/ReplaySubject';


/**
 *  队列服务
 */
@Injectable()
export class MenuSubject {
  private replaySubject: Subject<any> =  new ReplaySubject(1);

  constructor(
    private logUtil: LogUtil
  ) {}

  /**
   * 推送报警信息
   */
  pushData(data) {
    this.push(data);
  }
  private push(data) {
    // this.alarmSubject.next(data);
    this.replaySubject.next(data);
  }


  subscribeData(): Observable<string> {
    // return this.alarmSubject.asObservable();
    return this.replaySubject.asObservable();
  }
}
